<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>提示框效果</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .box{
            width: 800px;
            border: 1px solid #000;
            text-align: center;
            margin: 10px auto;
        }
        ul{
            display: flex;
            flex-wrap: wrap;
            justify-content: space-around;
            align-items: flex-start;
        }
        li{
            width: 140px;
            height: 140px;
            background-color: #F0F0F0;
            display: flex;
            align-items: center;
            flex-direction: column;
            justify-content: center;
            margin: 10px;
            position: relative;
            cursor:crosshair
        }
        h3{
            margin: 10px 0;
        }
        img{
            position: absolute;
            display: none;
        }
    </style>
</head>
<body>
    <div class="box">
        <h3>车标展示</h3>
        <ul>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">                
            </li>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">             
            </li>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">             
            </li>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">             
            </li>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">             
            </li>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">             
            </li>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">             
            </li>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">             
            </li>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">             
            </li>
            <li>
                <p>Lamborghini</p>
                <p>兰博基尼</p>
                <img src="./1.jpg" alt="">             
            </li>
        </ul>
    </div>

    <script>
        window.onload = function(){
            var lis = document.getElementsByTagName('li')
            var imgs = document.getElementsByTagName('img')
            for(let i=0; i<lis.length; i++){
                lis[i].onmouseenter = function(){
                    // console.log(lis[i].innerHTML);
                    // lis[i].innerHTML = '<img src="./1.jpg" alt="">'
                    imgs[i].style.display = 'block'
                }
            }


            for(let i=0; i<lis.length; i++){
                lis[i].onmouseleave = function(){
                    // console.log(lis[i].innerHTML);
                    // lis[i].innerHTML =  '<p>Lamborghini</p> <p>兰博基尼</p>'
                    imgs[i].style.display = 'none'
                }
            }
        }
    </script>
</body>
</html>